<@t.html>
<@t.container title="发送邮件列表" icon="envelope" >
  	       <!--operator-->
  	       <@t.btn_a name="发送邮件"  icon="send" href="admin/mail_record/toSend"/>
  	       <@t.btn_b name="删除记录" icon="trash" onclick="batchDeleteFun('admin/mail_record/delete');" />
  	       <!-- 常用查询 -->
  	       <@t.sform>
  	       		<@t.stext title="发送邮箱" id="to_mail" value="${search.to_mail}"/>	
  	       		<@t.select title="是否成功" formType="inline" labelCss="sr-only" id="success" datas={"1":"成功", "0":"失败"} defaultValue="${search.success}" />	
  	       		<@t.stext title="发送者邮箱"  id="from_email" value="${search.from_email}"/>	
  	       		<@t.select title="类型" formType="inline" labelCss="sr-only" id="type" datas={"1":"管理员发送", "0":"系统发送"} defaultValue="${search.type}"/>
  	       		<@t.btn_s name="查询"/>
  	       </@t.sform>
		   <!-- 常用查询 -->
  		   <@t.dt>
  		   		 <@t.dtheader>
						 <@t.column title="ID" />
						 <@t.column title="收件人" />
						 <@t.column title="收件箱" />
						 <@t.column title="发送日期" />
						 <@t.column title="是否成功" />
						 <@t.column title="附件" />
						 <@t.column title="发送者邮箱" />
						 <@t.column title="类型" />
				</@t.dtheader>
  			<@t.dtbody>
  				 <#list page.list as a>
                     <tr onclick="checkDataGridRow('${a.id}');">
                      	<td><input name='SelectedID' id="select_${a.id}" value="${a.id}" type="checkbox"></td>
                        <td>${a.id}</td>
						<td>${a.to_name}</td>
						<td>${a.to_mail}</td>
						<td>${a.to_date}</td>
						<td><@t.code defVal="${a.success}" datas={"1":"成功", "0":"失败"} /></td>
						<td><@t.code defVal="${a.attachment}" datas={"1":"无附件", "2":"有附件"} /></td>
						<td>${a.from_email}</td>
						<td><@t.code defVal="${a.type}" datas={"0":"系统发送", "1":"管理员发送"} /></td>
                        <td>
                        	<@t.btn_b name="删除" size="btn-xs" icon="trash" onclick="batchDeleteFun('admin/mail_record/delete','${a.id}');" />
							<@t.btn_a name="查看" size="btn-xs" icon="eye" href="admin/mail_record/toAdd?id=${a.id}"/>
							<@t.btn_b name="重新发送" size="btn-xs" icon="repeat" onclick="reSend('${a.id}');"/>
						</td>
                     </tr>
				 </#list>
  			</@t.dtbody>
  		</@t.dt>
  		<!--pager-->
  		<@t.back_pager objCount=page.totalRow pageSize=page.pageSize pageNum=page.pageNumber pageCount=page.totalPage></@t.back_pager>
  </@t.container>
<!-- dialog -->
<div id="dd"></div>
	<script type="text/javascript">
		function reSend(id){
			if(id=="")return;
			var dia = dialog({
			    title: '提示',
			    content: '正在发送邮件...'
			});
			dia.showModal();
			var data="record_id="+id;
			 $ .axsf('admin/mail_record/re_send',data,function(d){
			   		if(d){
		                   if(d.code==200){
								window.location.href="admin/mail_record/index";
		                   }else{
		                	   dia.content(d.message);
						}
		          	}
			   });
		}
	</script>
</@t.html>
